<h4>
  Best solutions of Problem <a href="problem/show/${pid!}">${pid!}</a>
</h4>
<div class="pull-left ajax-loader">
  <a url="problem/status/${pid!}<#if solutionList.pageSize!=20>?s=${solutionList.pageSize}</#if>"
     class="btn-link btn-info ajax-loader<#if !language?? || language==0> active</#if>">All</a>
<#if program_languages??>
  <#list program_languages.keySet() as key>
    <a url="problem/status/${pid!}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if>?language=${key!}"
       class="btn-link btn-info ajax-loader<#if language?? && language==key> active</#if>"
       type="a">${program_languages.get(key)!}</a>
  </#list>
</#if>
</div>
<div class="pull-right">
  <span class="badge badge-info">${solutionList.pageNumber}/${solutionList.totalPage} Pages</span> <span
        class="badge badge-info">${solutionList.totalRow}
  Records</span>
</div>
<table id="problem-status" class="table table-hover table-condensed">
  <thead>
  <tr>
    <th>Rank</th>
    <th>Run ID</th>
    <th>User</th>
    <th>Time</th>
    <th>Memory</th>
    <th>Language</th>
    <th>Code Length</th>
    <th>Submit Time</th>
  </tr>
  </thead>
  <tbody>
  <#if solutionList??> <#list solutionList.list as solution>
  <tr>
    <td class="id">${solution_index+1+(solutionList.pageNumber-1)*solutionList.pageSize}</td>
    <td class="sid">${solution.sid!}</td>
    <td class="user"><a href="user/profile/${(solution.name)!}">${(solution.name)!}</a></td>
    <td class="time">${solution.time!0} MS</td>
    <td class="memory">${solution.memory!0} KB</td>
    <td class="language"><#if user?? &&(adminUser?? || user.uid==solution.uid)><a href="code/${solution.sid!}"
                                                                                  target="_blank"
                                                                                  title="show source code"></#if>
    ${solution.languageName!} <#if user?? &&(adminUser?? || user.uid==solution.uid)></a></#if>
    </td>
    <td class="code_len">${solution.codeLen!}B</td>
    <td class="ctime">${solution.ctime!}</td>
  </tr>
  </#list> </#if>
  </tbody>
</table>
<div class="pagination pagination-centered ajax-loader">
  <ul>
    <li class="<#if solutionList.pageNumber==1>disabled</#if>"><a class="btn-link"
                                                                  url="problem/status/${pid!}?p=1<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">
      &lt;&lt;</a></li> <#if
  solutionList.pageNumber&gt;1>
    <li><a class="btn-link"
           url="problem/status/${pid!}?p=${solutionList.pageNumber-1}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">Prev</a>
    </li></#if>
  <#if solutionList??> <#assign start=solutionList.pageNumber-3> <#assign end=solutionList.pageNumber+3> <#if start<1><#assign end=end-start+1><#assign
  start=1></#if> <#if end&gt;solutionList.totalPage ><#assign start=start-(end-solutionList.totalPage)-1><#if start<1><#assign start=1></#if><#assign
  end=solutionList.totalPage></#if> <#if end
  <start><#assign end=start></#if> <#list start..end as x>
    <li class="<#if x==solutionList.pageNumber>active</#if>"><a class="btn-link"
                                                                url="problem/status/${pid!}?p=${x}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">${x}</a>
    </li>
  </#list> </#if> <#if solutionList.pageNumber<solutionList.totalPage>
    <li><a class="btn-link"
           url="problem/status/${pid!}?p=${solutionList.pageNumber+1}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">Next</a>
    </li>
  </#if>
    <li class="<#if solutionList.pageNumber&gt;=solutionList.totalPage>disabled</#if>"><a class="btn-link"
                                                                                          url="problem/status/${pid!}?p=${solutionList.totalPage}<#if solutionList.pageSize!=20>&s=${solutionList.pageSize}</#if><#if query??>${query}</#if>">
      &gt;&gt;</a></li>
  </ul>
</div>
</div>
</div>

<link rel="stylesheet" href="assets/tablecloth/css/tablecloth.css" type="text/css">
<script src="/assets/tablecloth/js/jquery.metadata.js"></script>
<script src="/assets/tablecloth/js/jquery.tablesorter.min.js"></script>
<script src="/assets/tablecloth/js/jquery.tablecloth.js"></script>

<script type="text/javascript">
  $(document).ready(function () {
  <#if oj_style != "slate">
    $("table#problem-status").tablecloth({
      theme: "stats",
      condensed: true,
      sortable: true,
      striped: true,
      clean: true
    });
  </#if>

    $('div.ajax-loader a').click(function () {
      var url = $(this).attr("url");
      if (url.indexOf('?') > 0)
        url = url + '&ajax=1';
      else
        url = url + '?ajax=1';
      $('div#ajax-container').load(url);
    });
  });
</script>
